Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

266
Visualizações
How can I have a variable of a clone (html elements) appear in another document and not disappear when I refresh [pretty new]

So basically I'm trying to make a very simple add to cart button.

You click, you can continue "browsing" and when you click to go to the cart it will be there in the format I have it set up in.

I don't exactly need help with having it appear with the right text but mostly with cloning it and then appearing in a entirely different document.

I've tried cloneNode, but that simply appears on the same document.

If you know of any functions/way's to help that would help me a lot.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can achieve this in many ways. From storing a value as a parameter in an URL, using localStorage, cookies, make your own state manager or use Redux, React Context API, MobX, etc.

Try with localStorage API.

localStorage.setItem('cartProduct', cartProduct)

then you can read it with

localStorage.getItem('cartProduct)

https://www.taniarascia.com/how-to-use-local-storage-with-javascript/

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda